<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>影片管理</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="/static/script/jquery-1.7.2.js"></script>
    <script>
        $(function (){
            $("#return").click(function (){
                location = "/login";
            });
            $("#add_film").click(function (){
                location = "/toUpdateOrAddFilmPage";
            });
            $(".deleteFilm").click(function (){
                //获取电影名称
                var filmName = $(this).attr("id")
                return confirm("确定要删除【"+filmName+"】这部影片吗？")
            });
        });
    </script>
</head>
<body>

<div id="login_page">
    <div class="logo" style="color: #39987c;"><img alt="" src="{{.User.ImgPath}}" style="width: 50px;height: 50px;border-radius: 50px;border: 2px solid darkblue;">{{.Username}}</div>
    <div id="films">
        <div id="main">
            <table id="films_table">
                <thead>
                <tr id="first_th">
                    <th>名称</th>
                    <th>类型</th>
                    <th>时长</th>
                    <th>价格</th>
                    <th>销量</th>
                    <th>票房</th>
                    <th>区域</th>
                    <th>状态</th>
                    <th>上映日期</th>
                    <th>下映日期</th>
                    <th colspan="3">操作</th>
                </tr>
                </thead>

                {{range .Films}}
                    <tr>
                        <td style="text-align: center">{{.FilmName}}</td>
                        <td style="text-align: center">{{.FilmType}}</td>
                        <td style="text-align: center">{{.Duration}} min</td>
                        <td style="text-align: center">{{.Price}}</td>
                        <td style="text-align: center">{{.Sales}}</td>
                        <td style="text-align: center">{{.TicketOffice}}</td>
                        <td style="text-align: center">{{.Zone}}</td>
                        {{if .State}}
                            <td style="text-align: center">即将上映</td>
                        {{else}}
                            <td style="text-align: center">正在热映</td>
                        {{end}}
                        <td style="text-align: center">{{.ScreenDate}}</td>
                        <td style="text-align: center">{{.OfflineDate}}</td>
                        <td style="text-align: center"><a href="/toUpdateOrAddFilmPage?filmName={{.FilmName}}">修改</a></td>
                        <td style="text-align: center"><a href="/deleteFilm?filmName={{.FilmName}}" id="{{.FilmName}}" class="deleteFilm">删除</a></td>
                    </tr>
                {{else}}
                <tr>
                    <td colspan="11">
                        <div>
                            ┭┮﹏┭┮ ，空空如也，快去添加演出计划吧~
                        </div>
                    </td>
                </tr>
                {{end}}

            </table>
        </div>
        <input type="button" value="返回" id="return">
        <input type="button" value="添加电影" id="add_film">
    </div>
</div>
</body>
</html>